entry {
    ui::interact-with-window {
        title: { const 'Window Demo' },
        content: Root,
        assets: [StyleSheet],
        on-close: { Some { sys::exit 0 } }
    }
};
asset StyleSheet: AssetCSS 'assets/style.css';

const Root: ui::Component
    \ use let buf := { ui::State::[String] 'lorem ipsum' },
    let show-another :=
        \ await let text := buf.out.sample,
        { show-another-window text },
    { { ui::Box [] } [
        { { ui::Box ['row'] } [
            ({ ui::TextView buf } with { ui::Style ['line-edit'] }),
            { ui::Button ('show another', (Noop with show-another)) }
        ] }
    ] };

function show-another-window:
    &(String) => Async
    &(text) => { with-canceller &(cancel) =>
        { ui::interact-with-window {
            title: { const text },
            content: { { ui::Box [] } [
                { ui::Label text },
                { ui::Button ('Cancel',cancel) }
            ] },
            assets: [StyleSheet],
            on-close: { Some cancel },
            size: { w: 10, h: 10 }
        } }
    };


